package modular.demo1;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.log4j.BasicConfigurator;

public class JobSubmitDemo1 {


    public static void main(String[] args) throws Exception {


        BasicConfigurator.configure();

        Configuration configuration = new Configuration();

        Job job = Job.getInstance(configuration);

        job.setJarByClass(JobSubmitDemo1.class);

        job.setMapperClass(FlowCountMapper.class);
        job.setReducerClass(FlowReduceMapper.class);

        job.setMapOutputKeyClass(Text.class);
        job.setMapOutputValueClass(FlowBean.class);

        //map 与 reduce OUT值类型一样时，可以省略下面两行
        job.setOutputKeyClass(Text.class);
        job.setOutputValueClass(FlowBean.class);


        FileInputFormat.setInputPaths(job, new Path("F:\\yue\\input"));
        FileOutputFormat.setOutputPath(job, new Path("F:\\yue\\output"));
        job.setNumReduceTasks(3);
        job.waitForCompletion(true);


    }
}
